﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TONLI.TJOA.Domain;
using TONLI.TJOA.Common;
using TONLI.Domain.RightManager;
using ComponentArt.Web.UI;



namespace TONLI.TJOA.Anquan
{
    public partial class FileAdd : System.Web.UI.Page
    {
        string dwid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            dwid = Request["dwid"];
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           
            string filename = Guid.NewGuid().ToString();
            TJOA_FileInfo file = new TJOA_FileInfo();
            file.UID = Guid.NewGuid().ToString();
            file.FileName = TextBox1.Text;
            string[] sub=FileUpload1.FileName.Split(".".ToCharArray());
            string hz=sub[sub.Length-1];
            //string deptid = ((Smmuser)Session["user"]).CorpDpt;

            //if (!string.IsNullOrEmpty(dwid)) deptid = dwid;
            file.hz = hz;
            file.Notes = TextBox2.Text;
            file.FileLength = FileUpload1.FileBytes.GetLength(0).ToString();
            file.CreateUser = ((Smmuser)Session["user"]).UserName;
            file.CreateDate = System.DateTime.Now;
            file.FilePath =  "..\\\\Upload\\\\Doc\\\\" + filename + "." + hz;
            file.Col1 = dwid;
            //file.Col2=CheckBox1.Checked.ToString();
            file.Col3 = TextBox3.Text;//作者
            FileUpload1.SaveAs(Server.MapPath("..\\")+"\\Upload\\Doc\\"+filename+"."+hz);
            DataService.BaseService().Create<TJOA_FileInfo>(file);

            Response.Redirect("FileMng.aspx?dwid=" + dwid);
        }
    }
}
